<?php
/**
 * Created by 784855684@qq.com.
 * Link: https://github.com/lichtung/wshore
 * User: linzh
 * Date: 7/10/17
 * Time: 6:56 PM
 */
declare(strict_types=1);


namespace application\module\admin\library\component;


use application\module\admin\addon\Sign;
use application\module\admin\library\Component;

class SideUserPanel extends Component
{
    public function __toString()
    {
        $user = Sign::getInstance()->getUser();
        $avatar = $user->avatar;
        if (strpos($avatar, 'data:image/') !== 0) {
            $avatar = WS_PUBLIC_URL . '/' . $avatar;
        }

        $content = <<< endline
<div class="user-panel">
    <div class="pull-left image">
        <img src="{$avatar}" class="img-circle" alt="User Image">
    </div>
    <div class="pull-left info">
        <p>{$user->nickname}</p>
        <!-- Status -->
        <a href="javascript:void(0);"><i class="fa fa-circle text-success"></i> Online</a>
    </div>
</div>
endline;
        return $content;
    }
}